const blockFacade = require('../facade/order.server.facade.js');
const _ = require('lodash');
const eventproxy = require('eventproxy');

module.exports = {
    updateBlockStateByMerchantId: updateBlockStateByMerchantId,
}

var ep = new eventproxy();
ep.on('err', function err(res, status, errMessage) {
    var data = {
        code: status,
        message: errMessage,
        data: null
    }
    res.json(data);
});


function updateBlockStateByMerchantId(req, res, next) {

    let params = req.params;
    let id = params.merchantId;
    let block = params.block;

    blockFacade.updateOrderStateByOrderId(id, block, function updateOrderStateByOrderIdCB(error, result) {

        if (error) {
            return next(error);
        }

        var data = {
            code: 200,
            message: 'Update success',
            data: null
        }

    });

}


